import axios from '@/libs/api.request'
// 查询商品信息
export const getProInfo = ({ codeTs, custName, goodsName, pageNum, pageSize }) => {
    return axios.request({
        url: '/customs/goodsDetail/queryGoods',
        data: {
            codeTs,
            custName,
            goodsName,
            pageNum,
            pageSize
        },
        method: 'post'
    })
}
// 新增商品信息
export const postProInfo = ({ codeTs, custId, declPrice, detailNo, firstScaleActor, firstUnit, goodsModel, goodsName, gunit, originCountry, secondUnit, tradeCurr }) => {
    return axios.request({
        url: '/customs/goodsDetail/addGoodsDetail',
        data: {
            codeTs,
            custId,
            declPrice,
            detailNo,
            firstScaleActor,
            firstUnit,
            goodsModel,
            goodsName,
            gunit,
            originCountry,
            secondUnit,
            tradeCurr
        },
        method: 'post'
    })
}
// 修改商品信息
export const putProInfo = ({ codeTs, custId, declPrice, detailNo, firstScaleActor, firstUnit, goodsModel, goodsName, gunit, originCountry, secondUnit, tradeCurr, goodsDetailId }) => {
    return axios.request({
        url: '/customs/goodsDetail/updateGoodsDetail',
        data: {
            codeTs,
            custId,
            declPrice,
            detailNo,
            firstScaleActor,
            firstUnit,
            goodsModel,
            goodsName,
            gunit,
            originCountry,
            secondUnit,
            tradeCurr,
            goodsDetailId
        },
        method: 'post'
    })
}
// 删除商品信息
export const delProInfo = ({ ids }) => {
    return axios.request({
        url: '/customs/goodsDetail/deleteGoodsByIds',
        data: {
            ids
        },
        method: 'delete'
    })
}
// excel商品明细模板下载
export const downloadPro = () => {
    return axios.request({
        url: '/customs/goodsDetail/downLoadGoodsDetailTemplate',
        method: 'get'
    })
}
// 批量导入商品明细
export const importPro = (file) => {
    return axios.request({
        url: '/customs/goodsDetail/importGoodsDetailByExcel',
        // headers: {'Content-Type': 'multipart/form-data'},
        data: file,
        method: 'post'
    })
}
// 商品ID查询
export const getProId = ({ goodsId }) => {
    return axios.request({
        url: '/customs/goodsDetail/queryGoodsById',
        params: {
            goodsId
        },
        method: 'post'
    })
}
// 查询客户信息
export const getCustomsInfo = ({ custType, username, pageNum, pageSize }) => {
    return axios.request({
        url: '/customs/customerManagement/query',
        data: {
            custType,
            username,
            pageNum,
            pageSize
        },
        method: 'post'
    })
}

// 查询数据字典
export const getAllCountry = ({ dataMainType, dataName }) => {
    return axios.request({
        url: '/ui/commonbasicdata/basicData/getCustomsBasicDataVo',
        data: {
            dataMainType,
            dataName
        },
        method: 'post'
    })
}

// 根据商品编码模糊查询商品信息
export const getPro = ({ keyWord, pageNum, pageSize }) => {
    return axios.request({
        url: '/ui/declaremanager/declareGoods/getCustomsHsCodeByCode',
        data: {
            pageNum,
            pageSize,
            keyWord
        },
        method: 'post'
    })
}

// 查询申请要素
export const getDetail = ({ codeTs }) => {
    return axios.request({
        url: '/ui/declaremanager/declareGoods/getCustomsHsCodeElementDocByCodeTs',
        data: {
            codeTs
        },
        method: 'post'
    })
}

// 查询商品要素 数据字典
export const getBasicDic = ({ dataMainType, keyWord }) => {
    return axios.request({
        url: '/customs/dic/getCustomsBasicDic',
        data: {
            dataMainType,
            keyWord
        },
        method: 'post'
    })
}

// 校验商品的唯一性
export const queryGoodsById = (data) => {
    return axios.request({
        url: '/customs/goodsDetail/queryGoodsByCustIdAndDetailNo',
        params: data,
        method: 'post'
    })
}
